package com.pand.service;

import com.pand.model.customer.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by lh on 2017/11/3.
 */
public interface CustomerService extends JpaRepository<Customer, Long> {
    @Query("select count(distinct cbc.customer.id) from CustomerBlgCty cbc " +
            "where cbc.customer.phone is not null " +
            "and cbc.customer.regTime is not null " +
            "and cbc.customer.isDeleted = false " +
            "and cbc.ownerCity.cityCode='400000'")
    long getRegisterCustomerAmount();

    @Query("select count(distinct b.customerId) from BizCustomerAuth b, CustomerBlgCty cbc " +
            "where b.customerId=cbc.customer.id " +
            "and b.isCheck = true " +
            "and cbc.ownerCity.cityCode='400000'")
    long getCertificationAmount();

//    long getActiveAmount();
}
